package com.yinda.dt.produce.view;

import android.content.Context;
import android.widget.TextView;

import com.github.mikephil.charting.components.MarkerView;
import com.github.mikephil.charting.data.CandleEntry;
import com.github.mikephil.charting.data.Entry;
import com.github.mikephil.charting.highlight.Highlight;
import com.yinda.dt.produce.R;


public class MyMakerView extends MarkerView {

    private TextView maker;

    public MyMakerView(Context context, int layoutResource) {
        super(context, layoutResource);
        this.maker = (TextView) findViewById(R.id.tv_maker);
    }

    @Override
    public int getXOffset(float arg0) {
        return -(getWidth() / 2);
    }

    @Override
    public int getYOffset(float arg0) {
        return (int) (-getHeight());
    }

    @Override
    public void refreshContent(Entry e, Highlight highlight) {
        if (e instanceof CandleEntry) {

            CandleEntry ce = (CandleEntry) e;
        } else {
            maker.setText((int)e.getY()+"");
        }
    }

}
